﻿using QRCodeBluetooth.Helper;
using QRCodeBluetooth.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace QRCodeBluetooth.DAL
{
    public class OwnerDAL
    {
        public bool AddOwner(OwnerInfo ownerInfo)
        {
            string strsql = string.Format(@"INSERT INTO owner_info(ownerName,identityInf,registerTime)VALUES('{0}','{1}','{2}')", ownerInfo.ownerName, ownerInfo.identityInf, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            return SqlHelper<OwnerInfo>.SqlExecute(strsql);
        }

        public int QueryOwner(string IdentityID)
        {
            string strsql = string.Format(@"SELECT id FROM owner_info WHERE IdentityInf='{0}'", IdentityID);
            return SqlHelper<OwnerInfo>.SqlScalar(strsql);
        }

    }
}
